import dataPreferences from '@ohos.data.preferences';

export   default  class preferenceModel{
    static preferences:dataPreferences.Preferences=null;

    static async  initPreference(context){
        this.preferences =await dataPreferences.getPreferences(context,"myStore");
    }
    static setPreference(key:string,value:string){
        this.preferences.put(key,value)
        this.preferences.flush();
    }
    static  getPreference(key:string){
      return  this.preferences.get(key,"")
    }
    static  delPreference(key:string){
        this.preferences.delete(key);
    }


}